package com.user.domain.dto;

import com.common.constant.GrepConstant;
import com.common.enums.user.SexEnum;
import com.common.enums.user.UserTypeEnum;
import com.core.domain.CoreDto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author: stefanie-zy
 * @time: 2024/1/25-16:03
 * @description: Dto-创建用户
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(name = "Dto-创建用户")
public class UserCreateDto extends CoreDto implements Serializable {
    @Serial
    private static final long serialVersionUID = -2787163678025934921L;

    @Schema(description = "姓名", requiredMode = Schema.RequiredMode.REQUIRED, pattern = GrepConstant.CHINESE)
    @Pattern(regexp = GrepConstant.CHINESE, message = "name must be Chinese")
    @NotBlank(message = "please enter the user name")
    private String userName;

    @Schema(description = "昵称")
    private String nickName;

    @Schema(description = "登录名", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "please enter the login name")
    private String loginName;

    @Schema(description = "密码")
    private String password;

    @Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "please enter the type")
    private UserTypeEnum type;

    @Schema(description = "手机号", pattern = GrepConstant.PHONE_NUMBER)
    @Pattern(regexp = GrepConstant.PHONE_NUMBER, message = "please enter the correct phone number")
    @NotBlank(message = "please enter the phone number")
    private String phoneNumber;

    @Schema(description = "邮箱", pattern = GrepConstant.EMAIL)
    @Pattern(regexp = GrepConstant.EMAIL, message = "please enter the correct email")
    private String email;

    @Schema(description = "身份证")
    @Pattern(regexp = GrepConstant.ID_CARD, message = "please enter the correct id card")
    private String idCard;

    @Schema(description = "地址")
    private String address;

    @Schema(description = "头像")
    private String icoUrl;

    @Schema(description = "性别", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "please enter the sex")
    private SexEnum sex;
}
